#include "TChain.h"
#include "TList.h"

//should have
//libReadoaAnalysis -> /data/t2k/xlu/software/t2k/nd280/nd280AnalysisTools/v1r9p3/amd64_linux26/AnalysisTools/libReadoaAnalysis/
//AnalysisTools -> /data/t2k/xlu/software/t2k/nd280/nd280AnalysisTools/v1r9p3/AnalysisTools/
//DO need to use t2ksoft.sh !!
#if !defined(__CINT__) || defined(__MAKECINT__)
#include "AnalysisTools/TCCreconAnalysisUtils.hxx"
#include "AnalysisTools/TGlobalAnalysisUtils.hxx"
#include "AnalysisTools/TNEUTAnalysisUtils.hxx"
#include "AnalysisTools/TTrackerAnalysisUtils.hxx"
#include "AnalysisTools/TCCtruthAnalysisUtils.hxx"
#include "AnalysisTools/TCheatingAnalysisUtils.hxx"
#include "AnalysisTools/TCheatingAnalysisUtils.hxx"
#include "AnalysisTools/TGlobalAnalysisUtils.hxx"
#include "AnalysisTools/TTruthUtils.hxx"
#endif

class AnaND280
{
 public:
  static void DoAnalysis(char *filelist, const Int_t ntarget, const TString tag);

 private:
  enum CutFlow {
  EventsSeen=11,
  EventsPassedPODVeto=12,
  EventsPassedTPC1Veto=13,
  EventsPassedBunchTiming=14,
  EventsPassedTPCInfo=15,
  EventsPassedVertexCut=16,
  EventsPassedForwardCut=17,
  EventsPassedTPC2Comp=18,
  EventsPassedMuonCandCut=19,
  EventsPassedMuonCut=20,
  EmptyBunch=21
  };

  static TChain * freconTracker     ;
  static TChain * freconGlobal      ;
  static TChain * fBasicHeader      ;
  //static TChain * fBasicDataQuality ;
  //static TChain * fBeamSummaryData  ;
  
  static TChain * fmcTruthRooTrackerVtx ;
  static TChain * fmcTruthVertices      ;
  static TChain * fmcTruthTrajects      ;
  
  static  Int_t fEventID ;
  static  Int_t fNTVtx ;
  static  TClonesArray *fVertices ;
  static  Int_t fNTraj ;
  static  TClonesArray *fTrajectories ;
  static  Int_t fNVtx ;
  static  TClonesArray * fVtx;
  static  Int_t fNPIDs ;
  static  TClonesArray * fPIDs ;
  static  Int_t fNTracks ;
  static  TClonesArray * fTracks ;

  static  Int_t ftTidPassMu ;
  static  Int_t ftRidPassMu ;

  static  Int_t GettTidPassMu(){ return ftTidPassMu;}
  static  Int_t GettRidPassMu(){ return ftRidPassMu;}

  //=======================================

  static Bool_t HasVetoTPCPOD(const Int_t ib);
  static Bool_t FGDCut(const TLorentzVector * fropos);
  static void IsTPCOK(const ND::TGlobalReconModule::TGlobalPID *trTrack, Bool_t &istpcok, Bool_t &ismuon);

  static void SetNeutrinoRec();

  static void SetNeutrinoParentPDG(const Int_t ib);
  static void SetNeutrinoMuonSim();

  static void SetMuonRec(const Int_t ib);

  //=======================
  static TList * fList;
  static Int_t IniIO(const TString filelist);
};
